package com.android.tea;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.android.tea.adapter.SessionAdapter;
import com.android.tea.entity.SessionInfo;

public class TeaFriendSessionActivity extends Activity implements OnClickListener{
	
	private Button btn_back;
	private ImageView personalcard;
	private TextView text_friendname;
	private ListView listView;
	private SessionAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.session);
		initComponents();
	}

	private void initComponents() {
		btn_back = (Button)findViewById(R.id.btn_back);
		btn_back.setOnClickListener(this);
		personalcard = (ImageView)findViewById(R.id.image_friend);
		text_friendname = (TextView)findViewById(R.id.friendname);
		listView = (ListView)findViewById(R.id.listView1);
		listView.setCacheColorHint(Color.TRANSPARENT);
		listView.setDividerHeight(0);
//		Bitmap bitmap = Bitmap.createBitmap(new int[] { 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFFFFFFF,
//				0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }, 2, 4, Config.RGB_565);
//		listView.setDivider(new BitmapDrawable(bitmap));
//		listView.setDividerHeight(2);
		ArrayList<SessionInfo> loadData = loadData();
		adapter = new SessionAdapter(this,loadData);
		listView.setAdapter(adapter);
	}

	private ArrayList<SessionInfo> loadData() {
		ArrayList<SessionInfo> list = new ArrayList<SessionInfo>();
		SessionInfo member4 = new SessionInfo();
//		member.setAvatar(avatar);
		member4.setTitle("善良的灰太狼一起去shopping?");
		member4.setDesc("一起去shopping?");
		member4.setTimeStamp(System.currentTimeMillis());
		member4.setType(0);
		list.add(member4);
		
		SessionInfo member = new SessionInfo();
//		member.setAvatar(avatar);
		member4.setType(1);
		member.setTitle("阿斯蒂芬煽风点火人体健康阿萨德?");
		member.setDesc("谢谢你的反馈");
		member.setTimeStamp(System.currentTimeMillis());
		list.add(member);
		
		return list;

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_back:
//			super.onBackPressed();
			
			Intent intent = new Intent(this,TeaFriendAreaSettingAtivity.class);
			startActivity(intent);
			
			break;

		default:
			break;
		}		
	}

}
